<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>

<style>
    .Completed,.status_2{color: #c00;}
    .Refunded,.status_1{color: #f60;}
    .Pending{color: #36c;}
    .Unclaimed,.status_3{color: #666;}
</style>
<div class="admin_nrtop">
    <div class="ad_search">
        <form action=""  method="get" style="margin:0px" id="form1">
            <div class="search">
                <div class="soubox">
                    <input type="text" id="quick" name="quick" value="<?php echo $this->quick ? $this->quick : ""; ?>"  placeholder="输入paypal账号"/>
                    <input type="hidden" id="seltime" name="seltime" value="<?php echo $this->seltime ? $this->seltime : ""; ?>" />
                    <input type="hidden" id="starttime" name="starttime" value="<?php echo $this->starttime ? $this->starttime : ""; ?>"/>
                    <input type="hidden" id="endtime" name="endtime" value="<?php echo $this->endtime ? $this->endtime : ""; ?>" />
                    <input type="hidden" id="taobaoid" name="taobaoid" value="<?php echo $this->taobaoid ? $this->taobaoid : ""; ?>" />
                    <input type="hidden" id="taobaoname" name="taobaoname" value="<?php echo $this->taobaoname ? $this->taobaoname : ""; ?>" />
                    <input type="hidden" id="pagesize" name="pagesize" value="<?php echo $this->pagesize ? $this->pagesize : ""; ?>" />
                    <input type="hidden" id="operatorname" name="operatorname" value="<?php echo $this->operatorname ? $this->operatorname : ""; ?>" />
                </div>
                <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
            </div>
            <div class="timebox">
                <div class="ad_time">
                    <div class="timezdy seltimeElder" style="width: 90px;">
                        <div class="timeselect2 seltime" >
                            <span><?php echo $this->seltime ? ($this->seltime == "createdTime" ? "创建时间" : "付款时间") : "创建时间"; ?></span><i></i>
                        </div>
                        <div class="timeslelct_xl seltimeAll" style="display:none;" style="width: 90px;">
                            <ul>
                                <li><a href="javascript:void(0)" name='createdTime' class='setseltime'>创建时间</a></li>
                                <li><a href="javascript:void(0)" name='paidTime' class='setseltime'>付款时间</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="timefw">
                        <div class="time">
                            <div class="timeselect" style="width:100px;padding-left: 2px;" id="stime">
                                <span id="stimeval"><?php echo $this->starttime ? $this->starttime : date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 90, date("Y"))); ?></span><i></i>
                            </div>
                            <div class="timeslelctbox"></div>
                        </div>
                        <div class="timezhi">
                            <span>至</span>
                        </div>
                        <div class="time">
                            <div class="timeselect" style="width:100px;padding-left: 2px;" id="etime">
                                <span id="etimeval"><?php echo $this->endtime ? $this->endtime : date("Y-m-d"); ?></span><i></i>
                            </div>
                            <div class="timeslelctbox"></div>
                        </div>
                    </div>
                    <div class="timezdy taobaonameElder" style="width: 90px;">
                        <div class="timeselect2 taobaoname" >
                            <span><?php echo $this->taobaoname ? $this->taobaoname : "购买帐号"; ?></span><i></i>
                        </div>
                        <div class="timeslelct_xl taobaonameAll" style="display:none;" style="width: 90px;">
                            <ul>
                                <li><a href="javascript:void(0)" name='0' class='settaobaoname'>所有</a></li>
                                <?php foreach ($this->taobaoAll as $taobaoVal) { ?>
                                    <li><a href="javascript:void(0)" name="<?php echo $taobaoVal->TaobaoSign; ?>" class='settaobaoname'><?php echo $taobaoVal->Taobaoname; ?></a></li>
                                <?php } ?> 
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="timeok">
                    <a href="javascript:$('#form1').submit();">确定</a>
                </div>
            </div>
        </form>
    </div>
</div>
<div  class="biaoge">
    <div class="biaotbody">
                <table>
                    <tr>
                        <th class="li205">
                            <div class="lijz"><input name="checkall" type="checkbox" id="checkall" value=""></div>
                        </th>
                        <th class="li9">
                            <div class="lileft">Paypal帐号</div>
                        </th>
                        <th class="li9">
                            <div class="lijz">国家</div>
                        </th>
                        <th class="li9">
                            <div class="lijz">城市</div>
                        </th>
                        <th class="li10">
                            <div class="lijz">悠奇用户ID</div>
                        </th>
                        <th class="li7">
                            <div class="lijz">详细地址</div>
                        </th>
                        <th class="li7">
                            <div class="lijz">姓名</div>
                        </th>
                        <th class="li7">
                            <div class="lijz">交易时间</div>
                        </th> 
                        <th class="li7">
                            <div class="lijz">操作</div>
                        </th>                       
                    </tr>
                </table>
            </div>
            <div class="table">
                <table>
                <?php 
                    if($this->Isapprove){
                    foreach ($this->Isapprove as $key => $item) {?>
                        <tr height='50px'>
                            <td class="li205"><div class="lijz"><input type="checkbox" id="chk<?php echo $item->id; ?>" name="ID" /></div></td>
                            <td class="li9">
                                <div class="lileft"><?php echo $item->payer_email;?></div>
                            </td>
                            <td class="li9"><div class="lijz"><?php echo $item->address_country;?></div></td>
                            <td class="li9"><div class="lijz"><?php echo $item->address_city;?></div></td>
                            <td class="li10"><div class="lijz"><a style="text-decoration:underline; color:blue" target="_blank"  href="/admini/manageuser/userdetail/id/<?php echo $item->Uuch_user_id;?>"><?php echo $item->Uuch_user_id;?></a></div></td>
                            <td class="li7"><div class="lijz"><?php echo $item->address_street;?></div></td>
                            <td class="li7"><div class="lijz"><?php echo $item->first_name;?></div></td>
                            <td class="li7"><div class="lijz"><?php echo $item->created_at;?></div></td>
                            <td class="li7">
                                <div class="lixlnav">
                                    <a class="xlnavxq" href="javascript:void(0)" >默认</a>
                                    <div class="xlnavlistbox" >
                                        <a class="xlnavsj" href="javascript:void(0)"><i></i></a>
                                        <div class="xlnavlist" style="display:none;width: 110px;">
                                            <ul>
                                                <li><a href="javascript:void(0);" class='setStatus' name='pass' i='<?php echo $item->Id;?>'>设为悠奇认证</a></li>                                                
                                                <li><a href="javascript:void(0);" class='setStatus' name='unpass' i='<?php echo $item->Id;?>'>设为悠奇未认证</a></li>
                                                <li><a href="javascript:void(0);" class='setStatus' name='black' i='<?php echo $item->Id;?>'>设为黑名单</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </td>                                               
                        </tr>
                <?php } } else { echo '<div class="tablebox">暂时无数据</div>';}?>
                </table>
            </div>
    </div>
<div class="toolbar">
<?php
echo $this->partial('paging.phtml', array("pages" => $this->data,"pamas"=>"quick=$this->quick&dateinbegin=$this->dateinbegin&dateinend=$this->dateinend"));        
?>
</div>    
<script>
    $('.soubox label').click(function(){
            $(this).parent().find('input').focus();
    });
    $(".timezdy").click(function(){
        $(".timezdy .timeselect2").attr("class","timeselect2 timeon");
        $(".timeslelct_xl").show();
    });
    $(".timezdy").mouseleave(function(){
       $(".timeselect2").attr("class","timeselect2");
       $(".timeslelct_xl").hide();
    });
    $("#stime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'stimeval',vel:'dateinbegin',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
        }});
    });
    $("#etime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'etimeval',vel:'dateinend',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
        }});
    });
    $(".lixiala").click(function(){
        $(".lixiala").attr("class","lixiala");
        $(".lixiala").next("div").hide();
    
        $(this).attr("class","lixiala bton");
        $(this).next("div").show();
    });

    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".biaoxiala").length == 0){
            $(".lixiala").attr("class","lixiala");
            $(".lixiala").next("div").hide();
        }
        if(target.closest("#stime").length == 0){
            $("#stime").attr("class","timeselect");
        }
        if(target.closest("#etime").length == 0){
            $("#etime").attr("class","timeselect");
        }
    });
    $(".xlnavsj").live("mousemove",function(){
        $(this).next("div").show();
    });
    $(".lixlnav").mouseleave(function(){
        $(".xlnavsj").next("div").hide();
    });
    function setProperty(property,value)
    {
        $("#form1 #"+property).val(value);
        $("#form1").submit();
    }
    function removeset(property)
    {
        $("#form1 #"+property).val("");
        $("#form1").submit();
    }
    $(".setStatus").click(function(){
       var status = $(this).attr("name");
       var statusName = $(this).text();
       var id = $(this).attr("i");
       if(confirm("您确定把该帐号"+statusName,"提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/paypal/setuuchstate/id/'+id+"/status/"+status,
                 success: function(data) {
                        if(data == 1){
                            alert("设置成功！");
                        }else{
                            alert("出现未知错误！");
                        }
                        location.reload();
                    }
               });
       }
    });
    
    $("a.uuch_user").click(function(){
        var userid = $(this).text(); 
        $.ajax({
           type: 'POST',
           url: '/admini/paypal/getpaypallist/userid/'+userid,
           success: function(data) {
                  alert(data);
            }
         });
         return false;
    });
    
    
    $("a.paypal").click(function(){
        var paypal = $(this).text(); 
        $.ajax({
           type: 'POST',
           url: '/admini/paypal/getuserlist/paypal/'+paypal,
           success: function(data) {
                  alert(data);
            }
         });
         return false;
    });
</script>
